<template>
  <div class="vol-dialog">
    <el-drawer
      :title="title"
      :modal="modal"
      :icon="icon"
      v-model="vmodel"
      :direction="direction"
      :size="width"
      :before-close="handleClose"
    >
      <el-scrollbar :max-height="contentHeight">
        <div
          v-if="inited"
          style="min-height: 50px"
          class="srcoll-content"
          :style="{ padding: padding + 'px' }"
        >
          <el-tabs v-model="activeName" @tab-click="handleClick">
            <el-tab-pane name="ssfa">
              <template #label>
                <div class="custom-tabs-label">
                  <i class="el-icon-document" :size="26"><CustomIcon /></i>
                  <span>市县实施方案</span>
                </div>
                <div class="custom-tabs-label" style="margin-left: 30px">
                  <span>/</span>
                </div>
              </template>
              <div>
                <div class="upload-container" style="width: 50%; float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      实施方案文件：
                      <a
                        style="color: blue; cursor: pointer"
                        @click="getShowPdf('ssfa', item.ssfaFileUrl)"
                        >{{ item.ssfaName }}</a
                      >
                    </div>

                    <p style="font-size: 13px; color: red; clear: ">
                      说明：公文或副封面和技术方案二选一进行上传，文件格式必须为.pdf；文件最大不能超过10M
                    </p>
                  </div>
                </div>
              </div>
            </el-tab-pane>

            <el-tab-pane name="jcbg">
              <template #label>
                <div
                  class="custom-tabs-label"
                  style="padding-left: 0px; margin-left: 0px"
                >
                  <i class="el-icon-document" :size="26"><CustomIcon /></i>
                  <span>任务区检查报告24</span>
                </div>
                <div class="custom-tabs-label" style="margin-left: 30px">
                  <span>/</span>
                </div>
              </template>
              <div>
                <div class="upload-container" style="width: 50%; float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      任务区检查报告：<a
                        style="color: blue; cursor: pointer"
                        @click="getShowPdf('jcbg', item.jcbgFileUrl)"
                        >{{ item.jcbgName }}</a
                      >
                    </div>

                    <p style="font-size: 13px; color: red; clear: ">
                      说明：文件格式必须为.pdf，文件最大不能超过10M
                    </p>
                  </div>
                </div>
               
              </div>
            </el-tab-pane>
            <el-tab-pane label="任务区技术总结报告" name="zjbg">
              <template #label>
                <div class="custom-tabs-label">
                  <i class="el-icon-document" :size="26"><CustomIcon /></i>
                  <span>任务区技术总结报告</span>
                </div>
                <div class="custom-tabs-label" style="margin-left: 30px">
                  <span>/</span>
                </div>
              </template>
              <div>
                <div class="upload-container" style="width: 50%; float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      任务区技术总结报告：<a
                        style="color: blue; cursor: pointer"
                        @click="getShowPdf('zjbg', item.zjbgFileUrl)"
                        >{{ item.zjbgName }}</a
                      >
                    </div>

                    <p style="font-size: 13px; color: red; clear: ">
                      说明：文件格式必须为.pdf，文件最大不能超过10M
                    </p>
                  </div>
                </div>
                
              </div>
            </el-tab-pane>
            <el-tab-pane label="两级检查记录" name="ljjl">
              <template #label>
                <div class="custom-tabs-label">
                  <i class="el-icon-document" :size="26"><CustomIcon /></i>
                  <span>两级检查记录</span>
                </div>
                <div class="custom-tabs-label" style="margin-left: 30px">
                  <span>/</span>
                </div>
              </template>
              <div style="width: 50%; float: left">
                <div class="upload-container" style=" float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      <span style="float: left;">一级记录：</span><div style="float: left;"><a
                        style="color: blue; cursor: pointer"
                        @click="getShowPdf('yjjl', item.yj_szzsyxtFileUrl)"
                        >{{ item.yj_szzsyxtName }}</a></div>
                      
                    </div>

                    <p style="font-size: 13px; color: red;clear:both">
                      说明：文件格式必须为.pdf，文件最大不能超过10M
                    </p>
                  </div>
                </div>
           
              </div>
              <div style="width: 50%; float: left">
                <div
                  class="upload-container"
                  style="float: left"
                >
                <div class="upload-item">
                  <div style="font-size: 13px; line-height: 32px">
                    <span style="float:left">两级记录：</span>
                    <div style="float: left;"><a
                      style="color: blue; cursor: pointer"
                      @click="getShowPdf('ljjl', item.lj_szzsyxtFileUrl)"
                      >{{ item.lj_szzsyxtName }}</a
                    ></div>
                 
                  </div>

                  <p style="font-size: 13px; color: red; clear:both">
                    说明：文件格式必须为.pdf，文件最大不能超过10M
                  </p>
                </div>
              </div>
             
         
              </div>
            </el-tab-pane>
            <el-tab-pane label="外业调查核查记录表" name="wydcjl">
              <template #label>
                <div class="custom-tabs-label">
                  <i class="el-icon-document" :size="26"><CustomIcon /></i>
                  <span>外业调查核查记录表</span>
                </div>
                <div class="custom-tabs-label" style="margin-left: 30px">
                  <span>/</span>
                </div>
              </template>
              <div>
                <div class="upload-container" style="width: 50%; float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      外业调查核查记录表：<a
                        style="color: blue; cursor: pointer"
                        @click="getShowPdf('wydcjl', item.wydcjlFileUrl)"
                        >{{ item.wydcjlName }}</a
                      >
                    </div>

                    <p style="font-size: 13px; color: red; clear: ">
                      说明：文件格式必须为.pdf，文件最大不能超过10M
                    </p>
                  </div>
                </div>
             
        
              </div>
            </el-tab-pane>
            <el-tab-pane label="机检记录" name="jjbg">
              <template #label>
                <div class="custom-tabs-label">
                  <i class="el-icon-document" :size="26"><CustomIcon /></i>
                  <span>机检记录</span>
                </div>
                <div class="custom-tabs-label" style="margin-left: 30px">
                  <span>/</span>
                </div>
              </template>
              <div style="width: 50%; float: left">
                <div class="upload-container" style="width: 50%; float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      机检记录报告：<a
                        style="color: blue; cursor: pointer"
                        @click="getShowPdf('jjbg', item.jjbgFileUrl)"
                        >{{ item.jjbgName }}</a
                      >
                    </div>

                    <p style="font-size: 13px; color: red">
                      说明：文件格式必须为.pdf，文件最大不能超过10M
                    </p>
                  </div>
                </div>
          
          
              </div>
            
              <div style="width: 50%; float: left">
                <div class="upload-container" style="width: 50%; float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      机检错误未修改说明：<a
                        style="color: blue; cursor: pointer"
                        @click="getShowPdf('jjbg', item.jccwwxgsmFileUrl)"
                        >{{ item.jccwwxgsmName }}</a
                      >
                    </div>

                    <p style="font-size: 13px; color: red">
                      说明：文件格式必须为.pdf，文件最大不能超过10M
                    </p>
                  </div>
                </div>
           
           
              </div>
            
            </el-tab-pane>
            <el-tab-pane label="地市级交验" name="djsjy">
              <template #label>
                <div class="custom-tabs-label">
                  <i class="el-icon-document" :size="26"><CustomIcon /></i>
                  <span>地市级交验</span>
                </div>
                <div class="custom-tabs-label" style="margin-left: 30px">
                  <span>/</span>
                </div>
              </template>
              <div>
                <div class="upload-container" style="width: 50%; float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      地市级交验：<a
                        style="color: blue; cursor: pointer"
                        @click="getShowPdf('djsjy', item.djsjyFileUrl)"
                        >{{ item.djsjyName }}</a
                      >
                    </div>

                    <p style="font-size: 13px; color: red; clear: ">
                      说明：文件格式必须为.pdf，文件最大不能超过10M
                    </p>
                  </div>
                </div>
        
            
              </div>
            </el-tab-pane>
            <el-tab-pane label="委托函" name="wth">
              <template #label>
                <div class="custom-tabs-label">
                  <i class="el-icon-document" :size="26"><CustomIcon /></i>
                  <span>委托函</span>
                </div>
                <div class="custom-tabs-label" style="margin-left: 30px">
                  <span>/</span>
                </div>
              </template>
              <div>
                <div class="upload-container" style="width: 50%; float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      委托函：<a
                        style="color: blue; cursor: pointer"
                        @click="getShowPdf('wth', item.wthFileUrl)"
                        >{{ item.wthName }}</a
                      >
                    </div>

                    <p style="font-size: 13px; color: red; clear: ">
                      说明：文件格式必须为.pdf，文件最大不能超过10M
                    </p>
                  </div>
                </div>
          
              
              </div>
            </el-tab-pane>
            <el-tab-pane label="抽样单" name="cyd">
              <template #label>
                <div class="custom-tabs-label">
                  <i class="el-icon-document" :size="26"><CustomIcon /></i>
                  <span>抽样单</span>
                </div>
                <div class="custom-tabs-label" style="margin-left: 30px">
                  <span>/</span>
                </div>
              </template>
              <div>
                <div class="upload-container" style="width: 50%; float: left">
                  <div class="upload-item">
                    <div style="font-size: 13px; line-height: 32px">
                      抽样单：<a
                        style="color: blue; cursor: pointer"
                        @click="getShowPdf('cyd', item.cydFileUrl)"
                        >{{ item.cydName }}</a
                      >
                    </div>

                    <p style="font-size: 13px; color: red; clear: ">
                      说明：文件格式必须为.pdf，文件最大不能超过10M
                    </p>
                  </div>
                </div>
            
        
              </div>
            </el-tab-pane>
            <el-tab-pane label="测绘资料交验移交清单" name="chzlyy">
              <template #label>
                <div class="custom-tabs-label">
                  <i class="el-icon-document" :size="26"><CustomIcon /></i>
                  <span>测绘资料交验移交清单</span>
                </div>
              </template>
              <div>
                <div class="upload-container" style="width: 50%; float: left">
                  <div class="upload-item" >
                    <div style="font-size: 13px; line-height: 32px">
                     <span style="float: left;">测绘资料交验移交清单： </span><a
                        style="color: blue; cursor: pointer"
                        @click="getShowPdf('chzlyy', item.chzlyyFileUrl)"
                        >{{ item.chzlyyName }}</a>
                    </div>
                    <el-upload
                        class="upload-demo"
                        :on-preview="chzlyy_handlePreview"
                        :on-remove="chzlyy_handleRemove"
                        :before-remove="chzlyy_beforeRemove"
                        multiple
                        :limit="3"
                        :on-exceed="handleExceed"
                        :file-list="chzlyy_chzlyy_fileList">
                        <div><el-button size="small" ><i class="el-icon-upload"></i>上传文件</el-button></div>
                    </el-upload>
                  </div>
                  <p style="font-size: 13px; color: red;  ">
                    说明：文件格式必须为.pdf，文件最大不能超过10M
                  </p>
                </div>
        
           
           
              </div>
            </el-tab-pane>
          </el-tabs>

          <el-row type="flex" justify="center" align="middle" style="height: 31vh">
        <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4">
          <el-button
            type="warning"
            class="edit_btn"
            @click="btnStaging"
            style="background: #e6a23c 80%;border: #e6a23c;"
            >暂存</el-button>
            &nbsp;&nbsp;&nbsp;&nbsp;
          <el-button type="primary" class="edit_btn" @click="btnSubmit"
            >提交申请</el-button
          >
        </el-col>
      </el-row>
        </div>
      </el-scrollbar>
    </el-drawer>
    <el-dialog
      v-model="fmodel"
      :pdfwidth="pdfwidth"
      :modal="fmodal"
      :before-close="handleFileClose"
    >
      <template #header> <i :class="icon"></i> {{ title }} </template>
      <el-scrollbar :max-height="contentHeight">
        <div
          v-if="inited"
          style="min-height: 500px"
          class="srcoll-content"
          :style="{ padding: padding + 'px' }"
        >
          <iframe
            :src="pdfUrl"
            height="100%"
            frameborder="0"
            scrolling="auto"
            width="100%"
            style="z-index: 1000; margin: 0 auto; height: 550px"
            sandbox="allow-scripts allow-top-navigation allow-same-origin allow-popups"
          ></iframe>
        </div>
      </el-scrollbar>
    </el-dialog>
  </div>
</template>

<script>
import { defineComponent, ref, watch, reactive } from "vue";

// import ssfa from "@/views/region_file/ssfa";
// import wth from "@/views/region_file/wth";
// import cyd from "@/views/region_file/cyd";
// //import chzlyy from "@/views/region_file/chzlyy";
// import chzlyy from "@/components/basic/chzlyyVolUpload.vue";
const fileurl = ref("");
export default defineComponent({
  props: {
    modelValue: false,
    pdfUrl: {
      type: String,
      default:
        "",
    },
    lazy: {
      //是否开启懒加载2020.12.06
      type: Boolean,
      default: false,
    },
    title: {
      type: String,
      default: "基本信息",
    },
    detailParams: {
      type: String,
      default: "",
    },
    height: {
      type: Number,
      default: 200,
    },
    width: {
      type: Number,
      default: 1500,
    },
    pdfwidth: {
      type: Number,
      default: 1000,
    },
    padding: {
      type: Number,
      default: 16,
    },
    modal: {
      //是否需要遮罩层
      type: Boolean,
      default: true,
    },
    fmodal: {
      //是否需要遮罩层
      type: Boolean,
      default: true,
    },
    draggable: {
      //启用可拖拽功能
      type: Boolean,
      default: false,
    },
    mask: {
      type: Boolean,
      default: true,
    },
    onModelClose: {
      //2021.07.11增加弹出框关闭事件
      type: Function,
      default: (iconClick) => {
        return true;
      },
    },
    fistfileName: {
      type: String,
      default: "",
    },
    fistfileUrl: {
      type: String,
      default: "",
    },
  },
  setup(props, context) {
    console.log('**************************',props.fistfileName)
    const item = reactive({
      ssfaName: "",
      jcbgName: "",
      zjbgName: "",
      yj_szzsyxtName: "",
      yj_jcsjcgName: "",
      yj_scysjName: "",
      yj_sdzpsjName: "",
      yj_wydcwjName: "",
      lj_szzsyxtName: "",
      lj_jcsjcgName: "",
      lj_scysjName: "",
      lj_sdzpsjName: "",
      lj_wydcwjName: "",
      wydcjlName: "",
      jjbgName: "",
      jccwwxgsmName: "",
      djsjyName: "",
      wthName: "",
      cydName: "",
      chzlyyName: "",
      ssfaFileUrl: "",
      jcbgFileUrl: "",
      zjbgFileUrl: "",
      yj_szzsyxtFileUrl: "",
      yj_jcsjcgFileUrl: "",
      yj_scysjFileUrl: "",
      yj_sdzpsjFileUrl: "",
      yj_wydcwjFileUrl: "",
      lj_szzsyxtFileUrl: "",
      lj_jcsjcgFileUrl: "",
      lj_scysjFileUrl: "",
      lj_sdzpsjFileUrl: "",
      lj_wydcwjFileUrl: "",
      wydcjlFileUrl: "",
      jjbgFileUrl: "",
      jccwwxgsmFileUrl: "",
      djsjyFileUrl: "",
      wthFileUrl: "",
      cydFileUrl: "",
      chzlyyFileUrl: "",
      radioValue: 0,
      ssfa_state: "",
      jcbg_state: "",
      zjbg_state: "",
      yj_szzsyxt_state: "",
      yj_jcsjcg_state: "",
      yj_scysj_state: "",
      yj_sdzpsj_state: "",
      yj_wydcwj_state: "",
      lj_szzsyxt_state: "",
      lj_jcsjcg_state: "",
      lj_scysj_state: "",
      lj_sdzpsj_state: "",
      lj_wydcwj_state: "",
      wydcjl_state: "",
      jjbg_state: "",
      jccwwxgsm_state: "",
      djsjy_state: "",
      wth_state: "",
      cyd_state: "",
      chzlyy_state: "",
      ssfa_shyj: "",
      jcbg_shyj: "",
      zjbg_shyj: "",
      yj_szzsyxt_shyj: "",
      yj_jcsjcg_shyj: "",
      yj_scysj_shyj: "",
      yj_sdzpsj_shyj: "",
      yj_wydcwj_shyj: "",
      lj_szzsyxt_shyj: "",
      lj_jcsjcg_shyj: "",
      lj_scysj_shyj: "",
      lj_sdzpsj_shyj: "",
      lj_wydcwj_shyj: "",
      wydcjl_shyj: "",
      jjbg_shyj: "",
      jccwwxgsm_shyj: "",
      djsjy_shyj: "",
      wth_shyj: "",
      cyd_shyj: "",
      chzlyy_shyj: "",
      fileList: [],
      url: "/api/zm_data_record/uploadobs",
      
    });
    const clientHeight = document.body.clientHeight * 0.95 - 60;
    const inited = ref(true);
    const vmodel = ref(false);
    const shyj = ref("");
    const fmodel = ref(false); //文件
    const footer = ref(false);
    const top = ref(100);
    vmodel.value = props.modelValue;
    footer.value = !!context.slots.footer;
    const contentHeight = ref(200);
    contentHeight.value = props.height;

    const handleClose = (done, iconClose) => {
      let result = props.onModelClose(!!iconClose);
      if (result === false) return;
      vmodel.value = false;
      context.emit("update:modelValue", false);
      done && done();
    };
    const getShowPdf = (titlename, fileurl) => {
      console.log(titlename,fileurl)
      props.pdfUrl=fileurl;
      fmodel.value = true;
      // fmodal.value=true;
    };
    const calcHeight = (val) => {
      contentHeight.value = clientHeight - 30;
      return clientHeight / -2 + "px";
    };
    const handleClick = (tab, event) => {
      var titlename = tab.props.name;
      console.log(props.detailParams);
      const model = props.detailParams.thisdata;
      const shitem=props.detailParams.thisaudit;
      if (model != undefined ) {
        console.log('*******************')
        if (titlename == "ssfa") {
          var v={name:model.jcbg_name,url:model.jcbg};
          item.fileList.push(v);
          item.ssfaName = model.ssfa_name;
          item.ssfaFileUrl = model.ssfa;
          item.ssfa_shyj = shitem.ssfa_sm;
          item.ssfa_state = shitem.ssfa_sh_state;
          console.log('*******************', item.fileList)
        } else if (titlename == "jcbg") {
          console.log("****tab****", titlename);
          var v={name:model.jcbg_name,url:model.jcbg};
          item.fileList.push(v);
          item.jcbgName = model.jcbg_name;
          item.jcbgFileUrl = model.jcbg;
          item.jcbg_shyj = shitem.jcbg_sm;
          item.jcbg_state = shitem.jcbg_sh_state;
        } else if (titlename == "zjbg") {
          item.zjbgName = model.zjbg_name;
          item.zjbgFileUrl = model.zjbg;
          item.zjbg_shyj = shitem.zjbg_sm;
          item.zjbg_state = shitem.zjbg_sh_state;
        } else if (titlename == "ljjl") {
          item.yj_szzsyxtName = model.yj_szzsyxt_name;
          item.yj_szzsyxtFileUrl = model.yj_szzsyxt;
          item.yj_szzsyxt_shyj = shitem.yj_szzsyxt_sm;
          item.yj_szzsyxt_state = shitem.yj_szzsyxt_sh_state;
          item.yj_jcsjcgName = model.yj_jcsjcg_name;
          item.yj_jcsjcgFileUrl = model.yj_jcsjcg;
          item.yj_jcsjcg_shyj = shitem.yj_jcsjcg_sm;
          item.yj_jcsjcg_state = shitem.yj_jcsjcg_sh_state;
          item.yj_scysjName = model.yj_scysj_name;
          item.yj_scysjFileUrl = model.yj_scysj;
          item.yj_scysj_shyj = shitem.yj_scysj_sm;
          item.yj_scysj_state = shitem.yj_scysj_sh_state;
          item.yj_sdzpsjName = model.yj_sdzpsj_name;
          item.yj_sdzpsjFileUrl = model.yj_sdzpsj;
          item.yj_sdzpsj_shyj = shitem.yj_sdzpsj_sm;
          item.yj_sdzpsj_state = shitem.yj_sdzpsj_sh_state;
          item.yj_wydcwjName = model.yj_wydcwj_name;
          item.yj_wydcwjFileUrl = model.yj_wydcwj;
          item.yj_wydcwj_shyj = shitem.yj_wydcwj_sm;
          item.yj_wydcwj_state = shitem.yj_wydcwj_sh_state;
          item.lj_szzsyxtName = model.lj_szzsyxt_name;
          item.lj_szzsyxtFileUrl = model.lj_szzsyxt;
          item.lj_szzsyxt_shyj = shitem.lj_szzsyxt_sm;
          item.lj_szzsyxt_state = shitem.lj_szzsyxt_sh_state;
          item.lj_jcsjcgName = model.lj_jcsjcg_name;
          item.lj_jcsjcgFileUrl = model.lj_jcsjcg;
          item.lj_jcsjcg_shyj = shitem.lj_jcsjcg_sm;
          item.lj_jcsjcg_state = shitem.lj_jcsjcg_sh_state
          item.lj_scysjName = model.lj_scysj_name;
          item.lj_scysjFileUrl = model.lj_scysj;
          item.lj_scysj_shyj = shitem.lj_scysj_sm;
          item.lj_scysj_state = shitem.lj_scysj_sh_state;
          item.lj_sdzpsjName = model.lj_sdzpsj_name;
          item.lj_sdzpsjFileUrl = model.lj_sdzpsj;
          item.lj_sdzpsj_shyj = shitem.lj_sdzpsj_sm;
          item.lj_sdzpsj_state = shitem.lj_sdzpsj_sh_state;
          item.lj_wydcwjName = model.lj_wydcwj_name;
          item.lj_wydcwjFileUrl = model.lj_wydcwj;
          item.lj_wydcwj_shyj = shitem.lj_wydcwj_sm;
          item.lj_wydcwj_state = shitem.lj_wydcwj_sh_state;
        } else if (titlename == "wydcjl") {
          item.wydcjlName = model.wydcjl_name;
          item.wydcjlFileUrl = model.wydcjl;
          item.wydcjl_shyj = shitem.wydcjl_sm;
          item.wydcjl_state = shitem.wydcjl_sh_state;
        } else if (titlename == "jjbg") {
          console.log(shitem);
          item.jjbgName = model.jjbg_name;
          item.jjbgFileUrl = model.jjbg;
          if(shitem!=null){
            item.jjbg_shyj = shitem.jjbg_sm;
            item.jjbg_state = shitem.jjbg_sh_state;
            item.jccwwxgsm_shyj = shitem.jccwwxgsm_sm;
            item.jccwwxgsm_state = shitem.jccwwxgsm_sh_state;
          }
          item.jccwwxgsmName = model.jccwwxgsm_name;
          item.jccwwxgsmFileUrl = model.jccwwxgsm;
        
        } else if (titlename == "djsjy") {
          item.djsjyName = model.djsjy_name;
          item.djsjyFileUrl = model.djsjy;
          item.djsjy_shyj = shitem.djsjy_sm;
          item.djsjy_state = shitem.djsjy_sh_state;
        } else if (titlename == "wth") {
          item.wthName = model.wth_name;
          item.wthFileUrl = model.wth;
          item.wth_shyj = shitem.wth_sm;
          item.wth_state = shitem.wth_sh_state;
        } else if (titlename == "cyd") {
          item.cydName = model.cyd_name;
          item.cydFileUrl = model.cyd;
          item.cyd_shyj = shitem.cyd_sm;
          item.cyd_state = shitem.cyd_sh_state;
        } else if (titlename == "chzlyy") {
          item.chzlyyName = model.chzlyy_name;
          item.chzlyyFileUrl = model.chzlyy;
          item.chzlyy_shyj = shitem.chzlyy_sm;
          item.chzlyy_state = shitem.chzlyy_sh_state;
        }
      }
    };
  
    top.value = calcHeight();
    watch(
      () => props.modelValue,
      (newVal, oldVal) => {
        vmodel.value = newVal;
      }
    );
    watch(
      () => props.detailParams,
      (newVal, oldVal) => {
        const model = props.detailParams.thisdata;
        const shitem = props.detailParams.thisaudit;
        if (model != null) {
          item.data_id = model.id;
          item.projectname = model.projectname;
          item.ssfaName = model.ssfa_name;
          item.ssfaFileUrl = model.ssfa;
          item.jcbgName = model.jcbg_name;
          item.jcbgFileUrl = model.jcbg;
          item.zjbgName = model.zjbg_name;
          item.zjbgFileUrl = model.zjbg;
          item.yj_szzsyxtName = model.yj_szzsyxt_name;
          item.yj_szzsyxtFileUrl = model.yj_szzsyxt;
          item.yj_jcsjcgName = model.yj_jcsjcg_name;
          item.yj_jcsjcgFileUrl = model.yj_jcsjcg;
          item.yj_scysjName = model.yj_scysj_name;
          item.yj_scysjFileUrl = model.yj_scysj;
          item.yj_sdzpsjName = model.yj_sdzpsj_name;
          item.yj_sdzpsjFileUrl = model.yj_sdzpsj;
          item.yj_wydcwjName = model.yj_wydcwj_name;
          item.yj_wydcwjFileUrl = model.yj_wydcwj;
          item.lj_szzsyxtName = model.lj_szzsyxt_name;
          item.lj_szzsyxtFileUrl = model.lj_szzsyxt;
          item.lj_jcsjcgName = model.lj_jcsjcg_name;
          item.lj_jcsjcgFileUrl = model.lj_jcsjcg;
          item.lj_scysjName = model.lj_scysj_name;
          item.lj_scysjFileUrl = model.lj_scysj;
          item.lj_sdzpsjName = model.lj_sdzpsj_name;
          item.lj_sdzpsjFileUrl = model.lj_sdzpsj;
          item.lj_wydcwjName = model.lj_wydcwj_name;
          item.lj_wydcwjFileUrl = model.lj_wydcwj;
          item.wydcjlName = model.wydcjl_name;
          item.wydcjlFileUrl = model.wydcjl;
          item.jjbgName = model.jjbg_name;
          item.jjbgFileUrl = model.jjbg;
          item.jccwwxgsmName = model.jccwwxgsm_name;
          item.jccwwxgsmFileUrl = model.jccwwxgsm;
          item.djsjyName = model.djsjy_name;
          item.djsjyFileUrl = model.djsjy;
          item.wthName = model.wth_name;
          item.wthFileUrl = model.wth;
          item.cydName = model.cyd_name;
          item.cydFileUrl = model.cyd;
          item.chzlyyName = model.chzlyy_name;
          item.chzlyyFileUrl = model.chzlyy;
        }
        if (shitem != null) {
          item.ssfa_shyj = shitem.ssfa_sm;
          item.ssfa_state = shitem.ssfa_sh_state;
          item.jcbg_shyj = shitem.jcbg_sm;
          item.jcbg_state = shitem.jcbg_sh_state;
          item.zjbg_shyj = shitem.zjbg_sm;
          item.zjbg_state = shitem.zjbg_sh_state;
          item.yj_szzsyxt_shyj = shitem.yj_szzsyxt_sm;
          item.yj_szzsyxt_state = shitem.yj_szzsyxt_sh_state;
          item.yj_jcsjcg_shyj = shitem.yj_jcsjcg_sm;
          item.yj_jcsjcg_state = shitem.yj_jcsjcg_sh_state;
          item.yj_scysj_shyj = shitem.yj_scysj_sm;
          item.yj_scysj_state = shitem.yj_scysj_sh_state;
          item.yj_sdzpsj_shyj = shitem.yj_sdzpsj_sm;
          item.yj_sdzpsj_state = shitem.yj_sdzpsj_sh_state;
          item.yj_wydcwj_shyj = shitem.yj_wydcwj_sm;
          item.yj_wydcwj_state = shitem.yj_wydcwj_sh_state;
          item.lj_szzsyxt_shyj = shitem.lj_szzsyxt_sm;
          item.lj_szzsyxt_state = shitem.lj_szzsyxt_sh_state;
          item.lj_jcsjcg_shyj = shitem.lj_jcsjcg_sm;
          item.lj_jcsjcg_state = shitem.lj_jcsjcg_sh_state;
          item.lj_scysj_shyj = shitem.lj_scysj_sm;
          item.lj_scysj_state = shitem.lj_scysj_sh_state;
          item.lj_sdzpsj_shyj = shitem.lj_sdzpsj_sm;
          item.lj_sdzpsj_state = shitem.lj_sdzpsj_sh_state;
          item.lj_wydcwj_shyj = shitem.lj_wydcwj_sm;
          item.lj_wydcwj_state = shitem.lj_wydcwj_sh_state;
          item.wydcjl_shyj = shitem.wydcjl_sm;
          item.wydcjl_state = shitem.wydcjl_sh_state;
          item.jjbg_shyj = shitem.jjbg_sm;
          item.jjbg_state = shitem.jjbg_sh_state;
          item.jccwwxgsm_shyj = shitem.jccwwxgsm_sm;
          item.jccwwxgsm_state = shitem.jccwwxgsm_sh_state;
          item.djsjy_shyj = shitem.djsjy_sm;
          item.djsjy_state = shitem.djsjy_sh_state;
          item.wth_shyj = shitem.wth_sm;
          item.wth_state = shitem.wth_sh_state;
          item.cyd_shyj = shitem.cyd_sm;
          item.cyd_state = shitem.cyd_sh_state;
          item.chzlyy_shyj = shitem.chzlyy_sm;
          item.chzlyy_state = shitem.chzlyy_sh_state;
        }
      }
    );

    return {
      handleClose,
      inited,
      vmodel,
      fmodel,
      footer,
      top,
      calcHeight,
      getShowPdf,
      handleClick,
      contentHeight,
      activeName: "ssfa",
      item,
      fileurl,
      shyj,
      url: "http://localhost:7777/api/zm_data_record/uploadobs",
      dmodel:true,
      chzlyy_fileList:[],
    };
  },
  methods: {
      chzlyy_handleRemove(file, chzlyy_fileList) {
        console.log(file, chzlyy_fileList);
      },
      chzlyy_handlePreview(file) {
        console.log(file);
      },
      chzlyy_handleExceed(files, chzlyy_fileList) {
        this.$message.warning(`当前限制选择 3 个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`);
      },
      chzlyy_beforeRemove(file, chzlyy_fileList) {
        return this.$confirm(`确定移除 ${ file.name }？`);
      },
      handleChange(file, fileList) {
       // this.fileList = fileList.slice(-3);
       console.log('================',fileList)
      },
      btnStaging() {
      console.log("------------编辑------------", this.chzlyy_fileList);
      console.log("------------编辑------------", );


      
      console.log("***参数***",this.projectname);
      var parms = {
        mainData: {
          projectname: this.projectname,
          ssfa: this.ssfaValue,
          jcbg: this.jcbgValue,
          zjbg: this.zjbgValue,
          yj_szzsyxt: this.yj_szzsyxtValue,
          yj_jcsjcg: this.yj_jcsjcgValue,
          yj_scysj: this.yj_scysjValue,
          yj_sdzpsj: this.yj_sdzpsjValue,
          yj_wydcwj: this.yj_wydcwjValue,
          lj_szzsyxt: this.lj_szzsyxtValue,
          lj_jcsjcg: this.lj_jcsjcgValue,
          lj_scysj: this.lj_scysjValue,
          lj_sdzpsj: this.lj_sdzpsjValue,
          lj_wydcwj: this.lj_wydcwjValue,
          wydcjl: this.wydcjlValue,
          jjbg: this.jjbgValue,
          jccwwxgsm: this.jccwwxgsmValue,
          djsjy: this.djsjyValue,
          wth: this.wthValue,
          cyd: this.cydValue,
          chzlyy: this.chzlyyValue,
          ssfa_name: this.ssfaName,
          jcbg_name: this.jcbgName,
          zjbg_name: this.zjbgName,
          yj_szzsyxt_name: this.yj_szzsyxtName,
          yj_jcsjcg_name: this.yj_jcsjcgName,
          yj_scysj_name: this.yj_scysjName,
          yj_sdzpsj_name: this.yj_sdzpsjName,
          yj_wydcwj_name: this.yj_wydcwjName,
          lj_szzsyxt_name: this.lj_szzsyxtName,
          lj_jcsjcg_name: this.lj_jcsjcgName,
          lj_scysj_name: this.lj_scysjName,
          lj_sdzpsj_name: this.lj_sdzpsjName,
          lj_wydcwj_name: this.lj_wydcwjName,
          wydcjl_name: this.wydcjlName,
          jjbg_name: this.jjbgName,
          jccwwxgsm_name: this.jccwwxgsmName,
          djsjy_name: this.djsjyName,
          wth_name: this.wthName,
          cyd_name: this.cydName,
          chzlyy_name: this.chzlyyName,
          yj_isys_dom: this.yj_isys_dom,
          yj_file_name: this.yj_file_name,
          yj_file_path: this.yj_file_path,
          lj_file_path: this.lj_file_path,
          lj_file_name: this.lj_file_name,
          lj_isys_dom: this.lj_isys_dom,
          submit_state:'0',
        },
        detailData: null,
        delKeys: null,
      };
      console.log("***参数***", parms);
      this.http.post("/api/zm_data_record/add", parms).then((result) => {
        console.log(result);
      //  this.$message.success(result);
        this.$alert(result.message, '消息提示', {
          confirmButtonText: '确定',
          callback: action => {
            console.log("成功");
           // this.$router.push("/applylist");
          }
        });
      //this.$message.success("提交成功，预审意见将在一到两个工作日内完成预审并反馈结果！如有问题，请联系0000-2393993");
      });
    },
    btnSubmit() {
      console.log("------------list------------", this.$store.state.filelist);
      console.log("------------list------------", this.$store.state.filelist.length);

      if (this.$store.state.filelist.length === 12) {

        for (var i = 0; i < this.$store.state.filelist.length; i++) {
          var name = this.$store.state.filelist[i].name;
          var item = this.$store.state.filelist[i].data;
          if (name === "ssfa") {
            this.ssfaValue = item[0].path;
            this.ssfaName = item[0].name;
          } else if (name === "jcbg") {
            this.jcbgValue = item[0].path;
            this.jcbgName = item[0].name;
          } else if (name === "zjbg") {
            this.zjbgValue = item[0].path;
            this.zjbgName = item[0].name;
          } else if (name === "yj") {
            for (var m = 0; m < this.$store.state.checked.length; m++) {
              if (this.$store.state.checked[m].name == "yj") {
                if (this.$store.state.checked[m].checked) {
                  this.yj_isys_dom = 1;
                } else {
                  this.yj_isys_dom = 0;
                }
              }
            }

            if (item.length == 1) {
              this.yj_file_name = item[0].name;
              this.yj_file_path = item[0].path;
            } else if (item.length > 1) {
              for (var n = 0; n < item.length; n++) {
                var filename = item[n].name;
                if (filename.includes("数字正射影像图") == true) {
                  this.yj_szzsyxtValue = item[i].path;
                  this.yj_szzsyxtName = item[i].name;
                } else if (filename.includes("监测数据成果") == true) {
                  this.yj_jcsjcgValue = item[i].path;
                  this.yj_jcsjcgName = item[i].name;
                } else if (filename.includes("生产元数据") == true) {
                  this.yj_scysjValue = item[i].path;
                  this.yj_scysjName = item[i].name;
                } else if (filename.includes("实地照片数据") == true) {
                  this.yj_sdzpsjValue = item[i].path;
                  this.yj_sdzpsjName = item[i].name;
                } else if (filename.includes("外业调查文件") == true) {
                  this.yj_wydcwjValue = item[i].path;
                  this.yj_wydcwjName = item[i].name;
                }
              }
            }
          } else if (name === "lj") {
            for (var m = 0; m < this.$store.state.checked.length; m++) {
              if (this.$store.state.checked[m].name == "yj") {
                if (this.$store.state.checked[m].checked) {
                  this.yj_isys_dom = 1;
                } else {
                  this.yj_isys_dom = 0;
                }
              }
            }

            if (item.length == 1) {
              this.lj_file_name = item[0].name;
              this.lj_file_path = item[0].path;
            } else if (item.length > 1) {
              for (var n = 0; n < item.length; n++) {
                var filename = item[n].name;
                if (filename.includes("数字正射影像图") == true) {
                  this.lj_szzsyxtValue = item[i].path;
                  this.lj_szzsyxtName = item[i].name;
                } else if (filename.includes("监测数据成果") == true) {
                  this.lj_jcsjcgValue = item[i].path;
                  this.lj_jcsjcgName = item[i].name;
                } else if (filename.includes("生产元数据") == true) {
                  this.lj_scysjValue = item[i].path;
                  this.lj_scysjName = item[i].name;
                } else if (filename.includes("实地照片数据") == true) {
                  this.lj_sdzpsjValue = item[i].path;
                  this.lj_sdzpsjName = item[i].name;
                } else if (filename.includes("外业调查文件") == true) {
                  this.lj_wydcwjValue = item[i].path;
                  this.lj_wydcwjName = item[i].name;
                }
              }
            }
          } else if (name === "wydcjl") {
            this.wydcjlValue = item[0].path;
            this.wydcjlName = item[0].name;
          } else if (name === "jjbg") {
            this.jjbgValue = item[0].path;
            this.jjbgName = item[0].name;
          } else if (name === "jccwwxgsm") {
            this.jccwwxgsmValue = item[0].path;
            this.jccwwxgsmName = item[0].name;
          } else if (name === "djsjy") {
            this.djsjyValue = item[0].path;
            this.djsjyName = item[0].name;
          } else if (name === "cyd") {
            this.cydValue = item[0].path;
            this.cydName = item[0].name;
          } else if (name === "wth") {
            this.wthValue = item[0].path;
            this.wthName = item[0].name;
          } else if (name === "chzlyy") {
            this.chzlyyValue = item[0].path;
            this.chzlyyName = item[0].name;
          }
        }
      } else {
        var fileType = [
          { name: "ssfa", title: "实施方案文件" },
          { name: "jcbg", title: "检查报告" },
          { name: "zjbg", title: "技术总结报告" },
          { name: "yj", title: "一级检查记录" },
          { name: "lj", title: "两级检查记录" },
          { name: "wydcjl", title: "外业调查核查记录表" },
          { name: "jjbg", title: "机检记录报告" },
          { name: "jccwwxgsm", title: "机检错误未修改说明" },
          { name: "djsjy", title: "地市级交验" },
          // { name: "cyd", title: "抽样单" },
          // { name: "wth", title: "委托函" },
          { name: "chzlyy", title: "测绘资料交验移交清单" },
        ];
        var uploadFileType = [];
        if (this.$store.state.filelist.length < 12) {
          for (var i = 0; i < this.$store.state.filelist.length; i++) {
            var name = this.$store.state.filelist[i].name;
            uploadFileType.push(name);
          }
          let result = fileType.filter((item) => {
            return uploadFileType.every((item1) => {
              return item.name != item1;
            });
          });
          console.log(result);
          if (result.length > 0) {
            for (var k = 0; k < result.length; k++) {
              this.$message.error("请选择上传相关" + result[k].title + "！");
            }
          }
        }
      }
      console.log("***参数***",this.projectname);
      var parms = {
        mainData: {
          projectname: this.projectname,
          ssfa: this.ssfaValue,
          jcbg: this.jcbgValue,
          zjbg: this.zjbgValue,
          yj_szzsyxt: this.yj_szzsyxtValue,
          yj_jcsjcg: this.yj_jcsjcgValue,
          yj_scysj: this.yj_scysjValue,
          yj_sdzpsj: this.yj_sdzpsjValue,
          yj_wydcwj: this.yj_wydcwjValue,
          lj_szzsyxt: this.lj_szzsyxtValue,
          lj_jcsjcg: this.lj_jcsjcgValue,
          lj_scysj: this.lj_scysjValue,
          lj_sdzpsj: this.lj_sdzpsjValue,
          lj_wydcwj: this.lj_wydcwjValue,
          wydcjl: this.wydcjlValue,
          jjbg: this.jjbgValue,
          jccwwxgsm: this.jccwwxgsmValue,
          djsjy: this.djsjyValue,
          wth: this.wthValue,
          cyd: this.cydValue,
          chzlyy: this.chzlyyValue,
          ssfa_name: this.ssfaName,
          jcbg_name: this.jcbgName,
          zjbg_name: this.zjbgName,
          yj_szzsyxt_name: this.yj_szzsyxtName,
          yj_jcsjcg_name: this.yj_jcsjcgName,
          yj_scysj_name: this.yj_scysjName,
          yj_sdzpsj_name: this.yj_sdzpsjName,
          yj_wydcwj_name: this.yj_wydcwjName,
          lj_szzsyxt_name: this.lj_szzsyxtName,
          lj_jcsjcg_name: this.lj_jcsjcgName,
          lj_scysj_name: this.lj_scysjName,
          lj_sdzpsj_name: this.lj_sdzpsjName,
          lj_wydcwj_name: this.lj_wydcwjName,
          wydcjl_name: this.wydcjlName,
          jjbg_name: this.jjbgName,
          jccwwxgsm_name: this.jccwwxgsmName,
          djsjy_name: this.djsjyName,
          wth_name: this.wthName,
          cyd_name: this.cydName,
          chzlyy_name: this.chzlyyName,
          yj_isys_dom: this.yj_isys_dom,
          yj_file_name: this.yj_file_name,
          yj_file_path: this.yj_file_path,
          lj_file_path: this.lj_file_path,
          lj_file_name: this.lj_file_name,
          lj_isys_dom: this.lj_isys_dom,
          submit_state:1,
        },
        detailData: null,
        delKeys: null,
      };
      console.log("***参数***", parms);
      this.http.post("/api/zm_data_record/add", parms).then((result) => {
        console.log(result);
        this.$alert(result.message, '消息提示', {
          confirmButtonText: '确定',
          callback: action => {
            console.log("成功");
            //this.$router.push("/applylist");
          }
        });
      });
    },
  },
});
</script>

<style lang="less" scoped>
/* 为 el-drawer 的标题添加下划线 */

.dia-footer {
  text-align: right;
  width: 100%;
  border-top: 1px solid #e2e2e2;
  text-align: right;
  padding: 6px 8px;
}
</style>

<style scoped lang="less">
.vol-dialog ::v-deep(.el-drawer__body) {
  border-top: 1px solid var(--el-menu-border-color);
  padding-top: 10px;
}
.vol-dialog ::v-deep(.el-drawer__header) {
  margin-bottom: 15px !important;
}
.vol-dialog ::v-deep(.el-tabs__item) {
  padding: 0px 15px;
}
.vol-dialog ::v-deep(.el-tabs__item.is-active) {
  color: #000;
  font-weight: bold;
}
.vol-dialog ::v-deep(.el-dialog__header) {
  border-bottom: 1px solid #d0d0d0;
}

.edit_btn {
  min-height: 40px;
  min-width: 100px;
  background: #409eff 80%;
  border: #409eff;
  font-size: 20px;
}
.el-upload-dragger{border:1px solid #dcdfe6 !important}
</style>
